// 故事详情
<template>
	<view class="content" v-show="isRequestSuccess">
		<view class="title">
			{{ dataInfo.name }}
		</view>
		<view class="author_readNum_content">
			<view class="author">
				投稿作者: {{ dataInfo.author }}
			</view>
			<view class="readNum">
				阅读量: {{ dataInfo.num_read }}
			</view>
		</view>
		<view class="textContent">
			{{ dataInfo.info }}
		</view>
		
	</view>
</template>

<script>
	import interfaces from "@/utils/interfaces.js"
	import config from "@/utils/config.js"
	
	export default {
		data() {
			return {
				data:{},
				dataInfo:{},
				isRequestSuccess: false
			}
		},
		methods: {
			requestData() {
				let id = this.data.news_id
				let url = interfaces.store_details + id + ".json";
				let self = this
				self.request({
					url:url,
					methods:"GET",
					success:(res)=> {
						// console.log(res)
						self.isRequestSuccess = true
						self.dataInfo = res.content
					},
					fail:(error)=> {
						console.log("错误 错误 错误:" + error + ":" + url)
					}
				})	
			}
		},
		onLoad(option) {
			this.data = JSON.parse(option.data)
			this.requestData()
		}
	}
</script>

<style lang="scss">
	.content{
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
		margin: 20px;
		// background-color: red;
		
		.title{
			font-size: 28px;
			font-weight: 500;
		}
		
		.author_readNum_content{
			display: flex;
			box-sizing: border-box;
			flex-wrap: row;
			margin-top: 10px;
			justify-content: space-between;
			
			.author{
				width: 60%;
				font-size: 14px;
				color: #A5A5A5;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
			.readNum{
				width: 40%;
				text-align: right;
				font-size: 14px;
				color: #A5A5A5;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}
		
		.textContent{
			display: flex;
			box-sizing: border-box;
			font-size: 17px;
			margin-top: 20px;
			margin-bottom: 40px;
			line-height: 60rpx;
		}
	}
</style>

